//
//  CYAppCleaner.m
//  cyjf
//
//  Created by tauCross on 2017/6/5.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYAppCleaner.h"

#import <WebKit/WebKit.h>



@implementation CYAppCleaner

+ (void)clear
{
    [[CYAppCleaner standardCleaner] clear];
}

+ (instancetype)standardCleaner
{
    static CYAppCleaner *cleaner = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        cleaner = [[CYAppCleaner alloc] init];
    });
    return cleaner;
}

- (void)clear
{
    [self clearWKWebViewCache];
}

#pragma mark - Clear
- (void)clearWKWebViewCache
{
    NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
    NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
    [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
        
    }];
}

@end
